﻿Imports System.Text
Imports System.Security.Cryptography
Public Class Crypt
    Public Shared Function MD5(ByVal Str As String) As String
        Dim ASCII As New ASCIIEncoding
        Dim ByteStr As Byte() = ASCII.GetBytes(Str) '转换为哈希值Byte数组
        Dim CMD5 As New MD5CryptoServiceProvider
        Dim MD5Byte As Byte() = CMD5.ComputeHash(ByteStr)
        Dim MD5Str As String = "" 'System.BitConverter.ToString(MD5Byte)
        For Each b As Byte In MD5Byte
            MD5Str += b.ToString("X")
        Next
        Return MD5Str
    End Function
End Class
